May 94 - A Hack on the Wild Slide
A Hack on the Wild Slide
Tom Becker
Yes, I was there. The Wednesday Night Hack-Off. They filled the room, munching
brownies and quaffing caffeine-laced beverages. No, I can't give you any names.
They're OOF hackers. Object Oriented Frameworks. Plenty of class, but no hierarchy.
They were there, trying out the latest tools. Cranking code until sunrise. Hacking
digital data structures into analog engines of computation: the original GUI calculator.
Slide rule with a Daystar accelerator.
The spec. It was hand drawn. Just one sheet hot off the copier. It was crude. It was
vague. It was factually incorrect. Yes, I wrote it. You got a problem? We didn't want
anything to impede the hacker's raw creativity. Besides, this exercise was supposed to
be realistic.
I walked in about 8 or so, after the Alger Memorial Pizza Feed. The hacker's den was
already hopping. I already knew what I wanted to try: Get started with AppMaker to
draw the GUI and generate TCL code. Finish with the fast turnaround times of THINK C.
Started working in a whirlwind of effort. Wait a minute. Things were missing. We're
not in AppMaker any more, Toto. Was this alpha code or what? Ran out into the hallway
and grabbed Spec Bowers. (At the Frameworks Conference, support is never far
away.) He wanted to know how I liked the prototype. It was great, but there was a slide
rule waiting for me.
Quickly dropping down a level of abstraction, I copied the starter project from the TCL
demos. Renamed the files. Now I had a working app with a window. Time to draw some
things. The copy of THINK Reference installed on the machine didn't include the toolbox
reference or TCL. Fortunately, most of the toolbox functions I needed were in
QuickDraw.h, and there was a printed TCL reference. Created a pane class for each part
of the slide rule. Became very familiar with the TCL reference. Created a mouse task
subclass to drag the slide. Found a disabled superview that was keeping clicks from
getting to the slider. Enabled it. Dragging the slide worked. Undo worked. Added a mouse
task to drag the indicator. Tried to remember how to draw logarithmic scales. At this
point, I was half done; ready to work on cosmetic issues. Got smooth dragging of the
indicator using XOR. Biggest problem was how to control TCL view focus/clipping.
Couldn't drag the slide from within a mouse task without flickering. Got it working
sort of OK by 6 AM. It was time. Slapped an icon on and shipped it.
Never used TCL before, but no problemo. Anyone with several years of MacApp
experience can get up to speed right away. Another big advantage: the quick turnaround
times with THINK C. I could make mistakes a lot faster. Experiment and let the
compiler check it. Real interactive programming.
Back home, I dug up my copy of An Easy Introduction to the Slide Rule. Isaac Asimov,
1965. "A slide rule," he says, "doesn't seem as impressive as a giant electronic
computer, but it has many advantages. It is small enough to put in your pocket, it need
not cost more than a couple of dollars, it can't go out of order, and, best of all, it can
solve almost any numerical problem that you meet up with under ordinary
circumstances. To add to all that, it is simple to operate." Right on.